package com.qiwx.pigeon.adapter.produce;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.qiwx.pigeon.R;
import com.qiwx.pigeon.Utils.DateTimeUtils;
import com.qiwx.pigeon.data.EnumGetOut;
import com.qiwx.pigeon.data.vo.GoOutBean;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @description
 * @Author qiwx
 * @Date 2020-03-29 15:35
 * 出栏记录 Adapter
 **/
public class GetOutReccordAdapter extends BaseQuickAdapter<GoOutBean, BaseViewHolder> {


    public GetOutReccordAdapter(int layoutResId) {
        super(layoutResId);
    }

    public GetOutReccordAdapter(int layoutResId, List<GoOutBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, GoOutBean bean) {

        holder.setText(R.id.txt_date, bean.getGoout_date());
        if (bean.getAmount() > 0) {
            holder.setText(R.id.txt_amount, "+" + bean.getAmount() + "只");
            holder.setTextColor(R.id.txt_amount, getContext().getResources().getColor(R.color.text_color_black));
        } else {
            holder.setText(R.id.txt_amount, bean.getAmount() + "只");
            holder.setTextColor(R.id.txt_amount, getContext().getResources().getColor(R.color.status_red_color));
        }
//        String operate_time= DateTimeUtils.showOperateTime(bean.getOperate_time());
        holder.setText(R.id.txt_pigeon_type, EnumGetOut.getTypeDes(bean.getType()));
    }
}
